//
//  FanDianDetailListCell.m
//  FactorySale
//
//  Created by 李 on 2020/1/13.
//  Copyright © 2020 主事丫环. All rights reserved.
//

#import "FanDianDetailListCell.h"

@implementation FanDianDetailListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setFrame:(CGRect)frame{
         frame.origin.x += 15;
         frame.size.width -= 30;
         [super setFrame:frame];

}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
    
        
        UILabel *moneyLab = [[UILabel alloc] init];
        moneyLab.text = @"";
        moneyLab.font =  KFontPingFangSCRegular(13);
        moneyLab.textAlignment = NSTextAlignmentCenter;
        moneyLab.textColor = [UIColor colorWithHexString:@"#333333"];
        moneyLab.numberOfLines = 0;
        [self.contentView addSubview:moneyLab];
        [moneyLab mas_makeConstraints:^(MASConstraintMaker *make) {
                         make.top.equalTo(self.contentView.mas_top).mas_offset(0);
                         make.left.equalTo(self.contentView.mas_left).mas_offset(16.5);
                    make.width.mas_greaterThanOrEqualTo(30);
                    make.height.mas_equalTo(40);

                     }];
        self.moneyLab = moneyLab;
        
        UILabel *secondLab = [[UILabel alloc] init];
        secondLab.text = @"";
        secondLab.font = KFontPingFangSCRegular(13);
        secondLab.textAlignment = NSTextAlignmentCenter;
        secondLab.textColor = [UIColor colorWithHexString:@"#333333"];
        secondLab.numberOfLines = 0;
        [self.contentView addSubview:secondLab];
        [secondLab mas_makeConstraints:^(MASConstraintMaker *make) {
             make.top.equalTo(self.contentView.mas_top).mas_offset(0);
        make.width.mas_greaterThanOrEqualTo(30);
        make.height.mas_equalTo(40);
            make.centerX.mas_equalTo(self.contentView);

         }];
         self.secondLab = secondLab;
        
         UILabel *thirdLab = [[UILabel alloc] init];
               thirdLab.text = @"已兑现";
               thirdLab.font = KFontPingFangSCRegular(13);
               thirdLab.textAlignment = NSTextAlignmentRight;
               thirdLab.textColor = [UIColor colorWithHexString:@"#333333"];
               thirdLab.numberOfLines = 0;
               [self.contentView addSubview:thirdLab];
        [thirdLab mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.top.equalTo(self.contentView.mas_top).mas_offset(0);
               make.width.mas_greaterThanOrEqualTo(30);
               make.height.mas_equalTo(40);
            make.right.equalTo(self.contentView.mas_right).mas_offset(-24.5);
                }];
         self.thirdLab = thirdLab;
        
        UIView *line = [[UIView alloc] init];
          line.backgroundColor = [UIColor colorWithHexString:@"#E5E5E5"];
          line.frame = CGRectMake(0, 40.5, KWIDTH-30, 0.5);
          [self.contentView addSubview:line];
        
    }
    return self;
}
-(void)setModel:(FanDainDetailListModel *)model
{
    _model = model;
    if (_model) {
                self.moneyLab.text = _model.money;
               self.secondLab.text = _model.create_time;
        //status    状态 1增加 未兑现 2减少 已兑现
        if ([_model.status isEqualToString:@"1"]) {
          self.moneyLab.textColor = [UIColor colorWithHexString:@"#999999"];
                                      self.secondLab.textColor = [UIColor colorWithHexString:@"#999999"];
                                      self.thirdLab.textColor = [UIColor colorWithHexString:@"#999999"];
             self.thirdLab.text = @"未兑现";
        }
        if ([_model.status isEqualToString:@"2"]) {
                   self.moneyLab.textColor = [UIColor colorWithHexString:@"#2BBA98"];
                             self.secondLab.textColor = [UIColor colorWithHexString:@"#2BBA98"];
                             self.thirdLab.textColor = [UIColor colorWithHexString:@"#2BBA98"];
             self.thirdLab.text = @"已兑现";
            
               }
              
              
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
